package com.woniuxy.infrastructure.controller;

import com.woniuxy.infrastructure.pojo.WcmCommunity;
import com.woniuxy.infrastructure.service.WcmCommunityService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/community")
@AllArgsConstructor
@CrossOrigin
public class CommunityController {
    private final WcmCommunityService wcmCommunityService;

    // 查询全部community
    @GetMapping("/all")
    public List<WcmCommunity> getAllCommunities() {
        return wcmCommunityService.list();
    }

    // 根据id查询community
    @GetMapping("/{id}")
    public WcmCommunity getCommunityById(@PathVariable Long id) {
        return wcmCommunityService.getById(id);
    }
} 